package com.fencing_squad.homo.component;

import de.hdodenhof.circleimageview.CircleImageView;
import ohos.agp.components.Attr;
import ohos.agp.components.AttrSet;
import ohos.app.Context;

import java.util.Optional;

public class FlexImage extends CircleImageView {
    private String bind = "";

    public FlexImage(Context context) {
        super(context);
    }

    public FlexImage(Context context, AttrSet attrSet) {
        super(context, attrSet);
        initConfig(attrSet);
    }

    public FlexImage(Context context, AttrSet attrSet, String s) {
        super(context, attrSet, s);
        initConfig(attrSet);
    }

    private void initConfig(AttrSet attrSet) {
        Optional<Attr> attr = attrSet.getAttr("flex_bind");
        attr.ifPresent(value -> bind = value.getStringValue());
    }
}
